#pragma once

#include "BaseInc.h"

#include "CImage.h"
#include "CWindowBuffer.h"
#include "CWindow.h"

class CPlatform : public IPlatform
{
public:
	static void InitialForm();
	static void UnInitialForm();
	static void AttachForm(HWND hWnd, CWindow * pWindow);
	static CWindow * FindForm(HWND hWnd);

private:
	static IPlatform * m_pInstance;
	static ListTmpl<CWindow *> m_allForms;
public:
	CPlatform();
	~CPlatform();

	void InitialPlatform();

	IForm * CreateForm();
	IForm * CreateForm(FormParam & param);
	IImage * CreateImageFromFile(const char_16 * szFile);
	IBuffer * CreateBuffer();

	int_x RunMessageLoop();
	void Quit(int_x iRetVal = 0);
};
